﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
using DQYT.HTDZ.BLL;
using DQYT.HTDZ.Model;

namespace DQYT.HTDZ.Web.BDZDJY
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (!PageValidate.IsDecimal(txtID.Text))
            {
                strErr += "ID格式错误！\\n";
            }
            if (this.txtWELLID.Text.Trim().Length == 0)
            {
                strErr += "WELLID不能为空！\\n";
            }
            if (!PageValidate.IsDecimal(txtPULLID.Text))
            {
                strErr += "PULLID格式错误！\\n";
            }
            if (!PageValidate.IsDateTime(txtZDSJ.Text))
            {
                strErr += "ZDSJ格式错误！\\n";
            }
            if (this.txtZJGL.Text.Trim().Length == 0)
            {
                strErr += "ZJGL不能为空！\\n";
            }
            if (this.txtWGBC.Text.Trim().Length == 0)
            {
                strErr += "WGBC不能为空！\\n";
            }
            if (this.txtCYJYXFX.Text.Trim().Length == 0)
            {
                strErr += "CYJYXFX不能为空！\\n";
            }
            if (this.txtPHTZ.Text.Trim().Length == 0)
            {
                strErr += "PHTZ不能为空！\\n";
            }
            if (this.txtPZTZ.Text.Trim().Length == 0)
            {
                strErr += "PZTZ不能为空！\\n";
            }
            if (this.txtFGQK.Text.Trim().Length == 0)
            {
                strErr += "FGQK不能为空！\\n";
            }
            if (this.txtGYQK.Text.Trim().Length == 0)
            {
                strErr += "GYQK不能为空！\\n";
            }
            if (this.txtCCTZ.Text.Trim().Length == 0)
            {
                strErr += "CCTZ不能为空！\\n";
            }
            if (this.txtCCITZ.Text.Trim().Length == 0)
            {
                strErr += "CCITZ不能为空！\\n";
            }
            if (this.txtPJDDJXN.Text.Trim().Length == 0)
            {
                strErr += "PJDDJXN不能为空！\\n";
            }
            if (this.txtPJCYJXN.Text.Trim().Length == 0)
            {
                strErr += "PJCYJXN不能为空！\\n";
            }
            if (this.txtPJJNGXN.Text.Trim().Length == 0)
            {
                strErr += "PJJNGXN不能为空！\\n";
            }
            if (this.txtPJSBGLSP.Text.Trim().Length == 0)
            {
                strErr += "PJSBGLSP不能为空！\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            decimal ID = decimal.Parse(this.txtID.Text);
            string WELLID = this.txtWELLID.Text;
            decimal PULLID = decimal.Parse(this.txtPULLID.Text);
            DateTime ZDSJ = DateTime.Parse(this.txtZDSJ.Text);
            string ZJGL = this.txtZJGL.Text;
            string WGBC = this.txtWGBC.Text;
            string CYJYXFX = this.txtCYJYXFX.Text;
            string PHTZ = this.txtPHTZ.Text;
            string PZTZ = this.txtPZTZ.Text;
            string FGQK = this.txtFGQK.Text;
            string GYQK = this.txtGYQK.Text;
            string CCTZ = this.txtCCTZ.Text;
            string CCITZ = this.txtCCITZ.Text;
            string PJDDJXN = this.txtPJDDJXN.Text;
            string PJCYJXN = this.txtPJCYJXN.Text;
            string PJJNGXN = this.txtPJJNGXN.Text;
            string PJSBGLSP = this.txtPJSBGLSP.Text;

            BDZDJYModel model = new BDZDJYModel();
            model.ID = ID;
            model.WELLID = WELLID;
            model.PULLID = PULLID;
            model.ZDSJ = ZDSJ;
            model.ZJGL = ZJGL;
            model.WGBC = WGBC;
            model.CYJYXFX = CYJYXFX;
            model.PHTZ = PHTZ;
            model.PZTZ = PZTZ;
            model.FGQK = FGQK;
            model.GYQK = GYQK;
            model.CCTZ = CCTZ;
            model.CCITZ = CCITZ;
            model.PJDDJXN = PJDDJXN;
            model.PJCYJXN = PJCYJXN;
            model.PJJNGXN = PJJNGXN;
            model.PJSBGLSP = PJSBGLSP;

            BDZDJYBLL bll = new BDZDJYBLL();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "add.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
